<?php

include '../includes/general.init.php';

// Make sure that the user is logged in
// and is an administrator.
include 'admin.init.php';

if (isset($_GET['show']))
{
	switch($_GET['show'])
	{
		case 'navbar':
			$sidebar = true;
			if ($include = opendir(ADM_ROOT)) {
				while (($file = readdir($include)) !== false) {
					if (substr($file, 0, 6) == 'admin_')
					{
						include ADM_ROOT . $file;
					}
				}
				closedir($include);
			}
			$tpl->pages = $pages;
			$tpl->display('sidebar.php');
		break;
		case 'header':
			$tpl->display('header.php');
		break;
		case 'index':
			include 'admin_home.php';
		break;
	}
}
else
{
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en"> 
<head> 
<script type="text/javascript"> 
<!--
// get out of any containing frameset
if (self.parent.frames.length != 0)
{
	self.parent.location.replace(document.location.href);
}
// -->
</script> 
<title><?php echo set::get('site_name'); ?>::Administration</title> 
</head> 
	<frameset cols="195,*" border="0" frameborder="0" frameborder="no" border="0"> 
	<frame src="index.php?show=navbar" name="nav" scrolling="yes" frameborder="0" marginwidth="0" marginheight="0" border="no" /> 
	<frameset rows="17,*" border="0" frameborder="0" frameborder="no" border="0"> 
		<frame src="index.php?show=header" name="head" scrolling="no" noresize="noresize" frameborder="0" marginwidth="10" marginheight="0" border="no" /> 
		<frame src="index.php?show=index" name="main" scrolling="yes" frameborder="0" marginwidth="10" marginheight="10" border="no" /> 
	</frameset> 
</frameset> 
<noframes> 
	<body> 
		<p>Please upgrade your browser.</p> 
	</body> 
</noframes> 
</html> 
<?php
}
session::clear_old();